package cn.supuwoerc.dao.impl;

import cn.supuwoerc.dao.UserDao;
import cn.supuwoerc.domain.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;
import java.util.Map;
import java.util.Properties;
//@Component("userDao")
@Repository("userDao")
public class UserDaoImpl implements UserDao {
    @Value("${jdbc.driverClassName}")
    private String username;
    @Value("16")
    private int age;
    private List<String> strList;
    private Map<String, User> userMap;
    private Properties properties;

    public List<String> getStrList() {
        return strList;
    }

    public void setStrList(List<String> strList) {
        this.strList = strList;
    }

    public Map<String, User> getUserMap() {
        return userMap;
    }

    public void setUserMap(Map<String, User> userMap) {
        this.userMap = userMap;
    }

    public Properties getProperties() {
        return properties;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public UserDaoImpl() {
        System.out.println("无参构造的方法被执行了");
    }
    @PostConstruct
    public void init() {
        System.out.println("执行初始化方法...");
    }
    @PreDestroy
    public void destroy() {
        System.out.println("执行销毁方法...");
    }

    public void save() {
        System.out.println(username+"---username");
        System.out.println(age+"---age");
        System.out.println(strList+"---strList");
        System.out.println(userMap+"---userMap");
        System.out.println(properties+"---properties");
        System.out.println("save function running...");
    }
}
